1. Field of the Invention
Embodiments of the present invention generally relate to debugging source code and, more particularly, to a method and apparatus for reverse debugging source code using causal analysis.
2. Description of the Related Art
When debugging source code, software developers often struggle to determine how execution of a program reached a particular line of code. A stack contains information about the execution of a program at a certain point in time. A stack frame is a storage area in the stack that contains subroutine state information. Specifically, each stack frame corresponds to a call to a subroutine that has not yet terminated with a return. The stack frame at the top of the stack is for a currently executing routine and typically includes arguments passed to the routine (if any), a return address back to the routine that called this routine, and space for local variables of the routine.
Currently, developers manually put trace statements into source code that can print information that describes the state of a variable or the location of the execution. For example, a trace statement may be “Print: Line 5, x=”, value of x″. This trace statement can tell the developer the value of x after the execution of line 5, to assist the developer in the debugging process. Manually determining the actual path of execution followed by a portion of source code that gave rise to a bug requires a considerable amount of time. A developer may also salvage information from a stack trace to assist in the debugging process. A stack trace is a report of the active stack frames at a certain point in time during the execution of a program. A stack trace allows a developer to trace a sequence of nested functions called up to the point where the stack trace was generated. However, only currently executing routine and subroutine information can be retrieved in a stack trace. A stack trace does not provide a complete path to reveal the execution path from the beginning of program execution. Hence, understanding change in control and values of variables during execution of source code for debugging remains a challenge for developers.
Therefore, there is a need in the art for a method and apparatus for reverse debugging of source code using causal analysis.